package org.jeecg.modules.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.utils.AliPayKit;
import org.jeecg.modules.utils.BikeResult;
import org.jeecg.modules.utils.HashCode;
import org.jeecg.modules.utils.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@Validated
@RestController
@CrossOrigin
@RequestMapping("/school")
@Api(value = "校车", description = "校车", tags = {"校车"})
public class SchoolBusController {

    @Value("${application.hc}")
    public String hcUrl;



    @ApiOperation(value = "校车跳转", notes = "校车跳转")
    @GetMapping("/bus")
    public BikeResult tz(@RequestParam(value = "phone") String phone){
        if (StringUtils.isNotEmpty(phone)){
            String url = HashCode.resaultUrl(phone);
            return BikeResult.ok("1", "成功", url);
        }else {
            return BikeResult.error("0", "失败", null);

        }
    }

    @ApiOperation(value = "公交跳转", notes = "公交跳转")
    @PostMapping("/gj")
    public BikeResult gj(){
        String url=  HashCode.resaultGjUrl();
        return BikeResult.ok("1","成功",url);
    }

    @ApiOperation(value = "换乘跳转", notes = "换乘跳转")
    @PostMapping("/hc")
    public BikeResult hc(){
        String url=  hcUrl;
        return BikeResult.ok("1","成功",url);
    }

}
